package com.smarthealthring.mm.presenter;

import com.smarthealthring.mm.api.ApiRequest;
import com.smarthealthring.mm.base.BasePresenter;
import com.smarthealthring.mm.contract.GetBackPwdContract;
import com.smarthealthring.mm.utils.ErrorHanding;
import com.smarthealthring.mm.utils.ToastUtil;

import java.util.Map;

/**
 * Created by bilibili on 2018/5/27.
 */

public class GetBackPwdPresenter extends BasePresenter<GetBackPwdContract.View> implements GetBackPwdContract.Presenter {

    @Override
    public void getVerifyCode(Map<String, String> params) {
        addSubscribe(ApiRequest.getVerifyCode(params)
                .subscribe(response -> {
                    mView.getVerifyCodeSuccess();
                }, throwable -> {
                    mView.getVerifyCodeFail();
                    ToastUtil.shortShow(ErrorHanding.handleError(throwable));
                }));
    }
}
